<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
  <head>    
    <title>猜数比较</title>
  </head>
  
	<body bgcolor="cyan">
  	<%
  		//获取表单中猜的数
  		String gn=request.getParameter("guess");
  		int guessnum=0;
  		try{
  			guessnum=Integer.parseInt(gn);
  		}catch(Exception e){
  			response.sendRedirect("inputGuess.jsp");
  		}
  		//计数器++
  		int m=(Integer)session.getAttribute("count");//0
  		m+=1;
  		session.setAttribute("count", m);
  		//获取随机数
  		int number=(Integer)session.getAttribute("save");
  		//判断
  		if(guessnum==number){
  			response.sendRedirect("sucess.jsp");
  		}else if(guessnum<number){
  			response.sendRedirect("small.jsp");
  		}else{
  			response.sendRedirect("large.jsp");
  		}
  	 %>
  	
  </body>
</html>
